﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/MainContent.Master"
    Inherits="System.Web.Mvc.ViewPage<MShop.Core.Domain.Product>" %>

<asp:Content ID="Contegnt1" ContentPlaceHolderID="TitleContent" runat="server">
    增加商品
</asp:Content>
<asp:Content ID="Contentgg2" ContentPlaceHolderID="MainContent" runat="server">
    <%=Html.Partial("ETTree",ViewData["itemcats"]) %>
    <div id="rightBox">
        <%: Html.ValidationSummary(false) %>
        <div id="formOutBox">
            <div id="formTitle">
                <div class="formTitleCard_c" id="Header1">
                    商品常规</div>
                <div class="formTitleCard" id="Header2">
                    商品介绍</div>
                <div class="formTitleCard" id="Header3">
                    售后服务</div>
                <div class="formTitleCard" id="Header4">
                    包装清单
                </div>
                <div class="formTitleCard" id="Header5">
                    规格参数</div>              
                <div class="formTitleCard" id="Header6">
                    其他</div>
                <div class="formTitleCard" id="Header7">
                    网页优化</div>
                 <div class="formTitleCard" id="Header8">
                    图片</div>
                <div class="formTitlRight">
                    <script type="text/javascript">
                        var LODOP = document.getElementById("LODOP"); //这行语句是为了符合DTD规范
                        CheckLodop();
                    </script>    
                    <img src="/Content/back.png" width="16" height="16" border="0" align="middle" style="margin-right: 3px;" />
                    <%: Html.ActionLink("返回", "Index", new { id =Request.Params["cid"],page=Request.Params["page"] })%>
                </div>
            </div>
            <div id="formBox">
                <% Html.EnableClientValidation(); %>
                <% using (Html.BeginForm())
                   {%>
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    id="Content1">
                    <tr>
                        <td width="15%">
                            <%: Html.LabelFor(model => model.CId) %>
                        </td>
                        <td>
                            <%=this.Select("cid").Options(ViewData["selectlist"] as IList<SelectListItem>)%>
                            
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.StandCode)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.StandCode)%>
                            <%: Html.ValidationMessageFor(model => model.StandCode)%>
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            <%: Html.LabelFor(model => model.SupplierId) %>
                        </td>
                        <td>
                            <%: Html.DropDownListFor(model => model.SupplierId, ViewData["suppliers"] as IEnumerable<SelectListItem>)%>
                            <%: Html.ValidationMessageFor(model => model.SupplierId)%>
                        </td>
                    </tr>
                     <tr>
                        <td width="15%">
                            <%: Html.LabelFor(model => model.Region) %>
                        </td>
                        <td>
                            <%: Html.DropDownListFor(model => model.Region, ViewData["Regions"] as IEnumerable<SelectListItem>)%>
                            <%: Html.ValidationMessageFor(model => model.Region)%>
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            <%: Html.LabelFor(model => model.BrandId) %>
                        </td>
                        <td>
                            <%: Html.DropDownListFor(model => model.BrandId, ViewData["brands"] as IEnumerable<SelectListItem>)%>
                            <%: Html.ValidationMessageFor(model => model.BrandId)%>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.ProductName)%>
                        </td>
                        <td>
                            <%: Html.TextBoxFor(model => model.ProductName, new { @style = "width:300px;", @class = "inputBox" })%>
                            <%: Html.ValidationMessageFor(model => model.ProductName)%>限定在30个汉字内（60个字符）
                        </td>
                    </tr>                     
                    <tr>
                        <td>
                            
<%: Html.LabelFor(model => model.Price)%>  <span style='color:red;'>*</span>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.Price)%>
                            <%: Html.ValidationMessageFor(model => model.Price)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                           
 <%: Html.LabelFor(model => model.ShopPrice) %>  <span style='color:red;'>*</span>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.ShopPrice)%>
                            <%: Html.ValidationMessageFor(model => model.ShopPrice)%>
                        </td>
                    </tr>
                 
                    <tr>
                        <td> 
                            <%: Html.LabelFor(model => model.Points)%><span style='color:red;'>*</span>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.Points)%>
                            <%: Html.ValidationMessageFor(model => model.Points)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                           
 <%: Html.LabelFor(model => model.CollectNum) %>  <span style='color:red;'>*</span>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.CollectNum)%>
                            <%: Html.ValidationMessageFor(model => model.CollectNum)%>
                        </td>
                    </tr>
                        <tr>
                        <td>                           
                            <%: Html.LabelFor(model => model.SaleNum) %>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.SaleNum)%>
                            <%: Html.ValidationMessageFor(model => model.SaleNum)%>
                        </td>
                    </tr>
                     <tr>
                        <td width="15%">
                            <%: Html.LabelFor(model => model.Sort) %>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.Sort)%>
                            <%: Html.ValidationMessageFor(model => model.Sort)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Status)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.Status, "ProductStatus")%>
                            <%: Html.ValidationMessageFor(model => model.Status)%>
                        </td>
                    </tr>
                   
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.IsRecommend)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.IsRecommend)%>
                            <%: Html.ValidationMessageFor(model => model.IsRecommend)%>
                            
                        </td>
                    </tr>    
                    <tr>
                    <td>
                     <%: Html.LabelFor(model => model.RecommendDay)%>
                         
                    </td>
                    <td>
                       <%:Html.EditorFor(m=>m.RecommendDay) %>
                            <%: Html.ValidationMessageFor(model => model.RecommendDay)%>
                    </td>
                    </tr>              
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.IsNew)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.IsNew)%>
                            <%: Html.ValidationMessageFor(model => model.IsNew)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.IsVirtual)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.IsVirtual)%>
                            <%: Html.ValidationMessageFor(model => model.IsVirtual)%>
                        </td>
                    </tr>

                     <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Unit)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.Unit)%>
                            <%: Html.ValidationMessageFor(model => model.Unit)%>
                        </td>
                    </tr>   <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Weight)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.Weight)%>
                            <%: Html.ValidationMessageFor(model => model.Weight)%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <hr />
                        </td>
                    </tr>
                    <% if (Request.Params["actiontype"] == "2")
                       { %>
                    <%=Html.Partial("product/keyPropControl", Model)%>
                    <%=Html.Partial("product/salePropControl", Model)%>
                    <%=Html.Partial("product/itemPropControl", Model)%> 
                    <%} %>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content2">
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Desc)%>
                        </td>
                        <td colspan="3">
                            <%: Html.TextAreaFor(model => model.Desc, new { @class = "ckeditor" })%>
                            <%: Html.ValidationMessageFor(model => model.Desc)%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <hr />
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content3">
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.HasInvoice)%>
                        </td>
                        <td colspan="3">
                            <%: Html.EditorFor(model => model.HasInvoice)%>
                            <%: Html.ValidationMessageFor(model => model.HasInvoice)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.HasWarranty)%>
                        </td>
                        <td colspan="3">
                            <%: Html.EditorFor(model => model.HasWarranty)%>
                            <%: Html.ValidationMessageFor(model => model.HasWarranty)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Warranty)%>
                        </td>
                        <td colspan="3">
                            <%: Html.TextAreaFor(model => model.Warranty, new { @class = "ckeditor" })%>
                            <%: Html.ValidationMessageFor(model => model.Warranty)%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <hr />
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content4">
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.IsPackage)%>
                        </td>
                        <td colspan="3">
                            <%: Html.EditorFor(model => model.IsPackage)%>
                            <%: Html.ValidationMessageFor(model => model.IsPackage)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Package)%>
                        </td>
                        <td colspan="3">
                            <%: Html.TextAreaFor(model => model.Package, new { @class = "ckeditor" })%>
                            <%: Html.ValidationMessageFor(model => model.Package)%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <hr />
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content5">
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Specification)%>
                        </td>
                        <td colspan="3">
                            <%: Html.TextAreaFor(model => model.Specification, new { @class = "ckeditor" })%>
                            <%: Html.ValidationMessageFor(model => model.Specification)%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <hr />
                        </td>
                    </tr>
                </table>              
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content6">
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.ListTime)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.ListTime)%>
                            <%: Html.ValidationMessageFor(model => model.ListTime)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.DeListTime)%>
                        </td>
                        <td>
                            <%: Html.EditorFor(model => model.DeListTime)%>
                            <%: Html.ValidationMessageFor(model => model.DeListTime)%>
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content7">
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Title)%>
                        </td>
                        <td colspan="3">
                            <%: Html.EditorFor(model => model.Title)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Keywords)%>
                        </td>
                        <td colspan="3">
                            <%: Html.EditorFor(model => model.Keywords)%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%: Html.LabelFor(model => model.Description)%>
                        </td>
                        <td colspan="3">
                            <%: Html.EditorFor(model => model.Description)%>
                        </td>
                    </tr>
                </table>

                 <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"
                    style="display: none;" id="Content8">
                    <tr>
                        <td>
                            <div class="pic">
            <ul>
                <% foreach (var item in Model.ProductImg)
                   { %>
                <li <% if(item.IsDefault) Response.Write("class='default'"); %>>
                    <a href="/admin/product/bigpic?picid=<%=item.Id %>" target="_blank">
                    <img src='<%=item.ThumbImageUrl %>' />
                    </a>
                  
                </li>
                <% } %>
            </ul>
        </div>
                        </td>
                         
                    </tr>
                </table>

                <%=Html.HiddenFor(m=>m.PropertyCount) %>
                <p style="text-align: center;">
                    <input type="button" value=" 返 回 " class="btn" onclick="location.href='<%=Url.Action("Index","Product",new{id=Request.Params["cid"]}) %>';" />
                    <input type="submit" value=" 保 存 " class="btn" />
                </p>
                <% } %>
            </div>
        </div>
    </div>
    <% SecureController controller = this.ViewContext.Controller as SecureController;
       Response.Write(Html.Hidden("HidPerPoint", controller.ShopContext.Settings.PerPoint));
         %>
</asp:Content>
<asp:Content ID="Contentgg3" ContentPlaceHolderID="cphMeta" runat="server">
    <script type="text/javascript" src="/ck/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="/ck/ckeditor/_samples/sample.js"></script>
    <script type="text/javascript" src="/ck/ckfinder/ckfinder.js"></script>
    <script type="text/javascript" src="/js/CheckActivX.js"></script>
    <object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0"
        height="0">
    </object>
    <script type="text/javascript">
        $(document).ready(function () {

            //选项卡按钮
            $('#formTitle').find("div").click(function () {
                var myid = this.id;
                var id = myid.replace('Header', '');
                for (var i = 1; i <= 8; i++) {
                    if (i == parseInt(id)) {
                        $('#Header' + i).removeClass().addClass("formTitleCard_c");
                        $('#Content' + i).show();
                    }
                    else {
                        $('#Header' + i).removeClass().addClass("formTitleCard");
                        $('#Content' + i).hide();
                    }
                }
            });

            $('#ShopPrice').blur(function () {
                var p = $('#HidPerPoint').val();

                if ($('#ShopPrice').val() == '') {
                    $('#Points').val('0');
                }
                else {
                    var value = parseFloat($('#ShopPrice').val());
                    var result = Math.round(p * value, 0);
                    $('#Points').val(result);
                }
            });

        });
    </script>  
</asp:Content>
 

<asp:Content ID="Content9" ContentPlaceHolderID="cphFooter" runat="server">
     <script type="text/javascript">

         var editor = CKEDITOR.replace('Warranty');
         CKFinder.setupCKEditor(editor, '/ck/ckfinder/');

         var editor1 = CKEDITOR.replace('Desc');
         CKFinder.setupCKEditor(editor1, '/ck/ckfinder/');

         var editor2 = CKEDITOR.replace('Package');
         CKFinder.setupCKEditor(editor2, '/ck/ckfinder/');


         var editor3 = CKEDITOR.replace('Specification');
         CKFinder.setupCKEditor(editor2, '/ck/ckfinder/');     
    </script>
</asp:Content>
